home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
GraphicViewers
/
pCD
/
Source
/
hpcdtoppm.0.4
/
hpcdtoppm.h.ORIG
< prev
next >
Wrap
Text File
|
1993-03-23
|
4KB
|
164 lines
/* hpcdtoppm (Hadmut's pcdtoppm) v0.4
* Copyright (c) 1992, 1993 by Hadmut Danisch (danisch@ira.uka.de).
* Permission to use and distribute this software and its
* documentation for noncommercial use and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation. It is not allowed to sell this software in
* any way. This software is not public domain.
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <sys/types.h>
#include <ctype.h>
/* Format definitions */
#define BaseW ((dim)768)
#define BaseH ((dim)512)
#define SECSIZE 0x800
#define SeHead 2
#define L_Head (1+SeHead)
#define SeBase16 18
#define L_Base16 (1+SeBase16)
#define SeBase4 72
#define L_Base4 (1+SeBase4)
#define SeBase 288
#define L_Base (1+SeBase)
#define neutrLum 128
#define neutrCh1 156
#define neutrCh2 137
/* Structures and definitions */
struct _implane
{dim mwidth,mheight,
iwidth,iheight;
uBYTE *im,*mp;
};
typedef struct _implane implane;
#define nullplane ((implane *) 0)
enum TURNS { T_UNSPEC,T_NONE,T_RIGHT,T_LEFT,T_AUTO };
enum SIZES { S_UNSPEC,S_Base16,S_Base4,S_Base,S_4Base,S_16Base,S_Over,S_Contact };
enum OUTFOR { O_UNSPEC,O_PPM,O_PGM,O_YCC,O_PS,O_EPS,O_PSG,O_EPSG };
enum CORR { C_UNSPEC,C_LINEAR,C_DARK,C_BRIGHT };
enum ERRORS { E_NONE,E_READ,E_WRITE,E_INTERN,E_ARG,E_OPT,E_MEM,E_HUFF,
E_SEQ,E_SEQ1,E_SEQ2,E_SEQ3,E_SEQ4,E_SEQ5,E_SEQ6,E_SEQ7,E_POS,E_IMP,E_OVSKIP,
E_TAUTO,E_TCANT };
/* Macros */
#ifdef DEBUG
extern long bufpos;
#define SEEK(x) { if (fseek(fin,((x) * SECSIZE),0)) error(E_READ);\
fprintf(stderr,"S-Position %x\n",ftell(fin)); }
#define RPRINT {fprintf(stderr,"R-Position %x\n",ftell(fin));}
#define READBUF (bufpos=ftell(fin),fread(sbuffer,sizeof(sbuffer),1,fin))
#else
#define SEEK(x) { if (fseek(fin,((x) * SECSIZE),0)) error(E_READ);}
#define RPRINT
#define READBUF fread(sbuffer,sizeof(sbuffer),1,fin)
#endif
#define melde(x) {if (do_melde) fprintf(stderr,x);}
#define EREADBUF {if(READBUF < 1) error(E_READ);}
#define SKIP(n) { if (fseek(fin,(n),1)) error(E_READ);}
#define SKIPr(n) { if (fseek(fin,(n),1)) return(E_READ);}
#define TRIF(x,u,o,a,b,c) ((x)<(u)? (a) : ( (x)>(o)?(c):(b) ))
#define xNORM(x) x=TRIF(x,0,255,0,x,255)
#define NORM(x) { if(x<0) x=0; else if (x>255) x=255;}
/* main.c */
extern void close_all();
extern FILE *fin,*fout;
extern char *ppmname,*pcdname;
extern int do_diff,do_info,do_sharp,do_overskip,monochrome;
extern int do_melde,do_rep,do_crop;
extern int flvert,flhori;
extern uBYTE sbuffer[SECSIZE];
extern enum TURNS turn;
extern enum SIZES size;
extern enum OUTFOR outfor;
extern enum CORR corrmode;
extern float PAPER_LEFT,PAPER_BOTTOM,PAPER_WIDTH,PAPER_HEIGHT;
/* error.c */
extern void error();
/* color.c */
extern void sharpit();
extern void colconvert();
/* tools.c */
extern long Skip4Base();
extern void clear();
extern void halve();
extern void interpolate();
extern void planealloc();
extern void pastein();
extern void cropit();
/* format.c */
extern void decode();
extern void readhqt();
extern enum ERRORS readplain();
/* output.c */
extern void druckeid();
extern void writepicture();
/* ppm.c */
extern void write_pgm();
extern void write_ppm();
/* postscr.c */
extern void write_epsgrey();
extern void write_psgrey();
extern void write_epsrgb();
extern void write_psrgb();